
#include<iostream>
#include<cstdio>
#include<cstring>
#include<stdexcept>
//#include"sriTCPCLient.h"
#include"sri.h"

using namespace std;

int main(int argc, char *argv[])
{

    SRI M4313;
    if(M4313.connectTo("192.168.0.108",4008)){
        cout<<"连接成功!"<<endl;
    }
    else{
        cout<<"连接失败!"<<endl;
    }
    cout<<"开始配置设备！"<<endl;

    try {

        M4313.atCommand("AT+SGDM=(A01,A02,A03,A04,A05,A06);E;1;(WMA:1)");
        M4313.atCommand("AT+DCKMD=SUM");
        M4313.atCommand("AT+SMPF=100");

    }  catch (exception& e) {
        cout<<"配置设备失败！"<<endl;
        cout<<"Error:"<<e.what()<<endl;
        return 0;
    }

    //多次读取
    while(true){
        vector<vector<float>> FM(6);
        FM=M4313.read();
        int length=FM[0].size();
        for(int i=0;i<length;i++){
            for(int j=0;j<6;j++){
                cout<<FM[j][i]<<' ';
            }
            cout<<endl;
        }
    }


    //单次读取
//    vector<float> fm(6);
//    fm=M4313.readOnce();
//    for(int i=0;i<6;i++){
//        cout<<fm[i]<<endl;
//    }
//    return 0;








}



























